{extend name="default/base/base_seller" /}
{block name="seller_main"}

<form method="get" action="">

    <input type="hidden" name="lock" value="{$Request.param.lock}" />
    <table class="search-form">
        <tr>
            <th class="">
                    商品
            </th>
            <td class="w160" ><input type="text" class="text" name="keyword" value="{$Request.get.keyword}" /></td>

            <td class="w70 " style=""><input type="submit" class="submit" value="{$Think.lang.ds_search}" /></td>
            <td class="w70 ">
                {if $goods_name}
                <a style="margin-left: -20px;" href="{:url('Sellerinquiry/sellergoods',['id'=>$inquiry_id])}" class="dssc-btn dssc-btn-red" title="取消">取消</a>
                {/if}
            </td>
            <td><a href="javascript:void(0)" onclick="add_goods({$inquiry_id});" style="" class="dssc-btn dssc-btn-green" title="导入商品">导入商品</a></td>

        </tr>
    </table>
</form>

<table class="dssc-default-table">
        <thead>
            <tr>

                <th class="w60 align-center">序号</th>
                <th>商品</th>
                <th class="w272 align-center">商品名称及规格值</th>
                <th class="w272 align-center">分类名称&品牌</th>
                <th class="w272 align-center">数量</th>

                <th class="w200 align-center">{$Think.lang.ds_handle}</th>
            </tr>
        </thead>

        <tbody>
            {notempty name="goods_list"}
            {foreach name="goods_list" item="type" key="k"}
            <tr >
               <td>{$k+1}</td>
              <td class="w60 picture">
                <img width="50px" height="50px" src="{$http_name}/{$type.goods_images}" />
              </td>
                <td>{$type.goods_name}</td>
                <td>
                <p>{$type.gc_name}</p>
                <p class="goods-brand">{$Think.lang.ds_brand}：{$type.brand_name}</p>
            </td>
                <td>
                    <input type="text" class="change_goods_storage" style="width: 80px;margin-left: 15px;" data-id="{$type.id}" value="{$type.num}">
                </td>
                <td class="dscs-table-handle">
                    <span><a href="javascript:void(0)" onclick="ds_ajaxget_confirm('{:url('Sellerinquiry/goods_drop',['id'=>$type.id])}','{$Think.lang.ds_ensure_del}');" class="btn-red"><i class="layui-icon">&#xe640;</i><p>{$Think.lang.ds_del}</p></a></span>
                </td>
            </tr>
            {/foreach}
             {/notempty}
        </tbody>
            <tfoot>
                {notempty name="bill_list"}
                <tr>
                    <td colspan="6"><div class="pagination">{$show_page}</div></td>
                </tr>
                {/notempty}
            </tfoot>
        </table>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/jquery.mousewheel.js"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js" charset="utf-8"></script>

<script src="{$Think.ADMIN_SITE_ROOT}/js/question.js"></script>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
        <script src="{$Think.HOME_SITE_ROOT}/js/store_goods_list.js"></script>
        <script type="text/javascript">
        $(function(){
            $('#query_start_date').datepicker({dateFormat: 'yy-mm-dd'});
            $('#query_end_date').datepicker({dateFormat: 'yy-mm-dd'});
        });

        //导入商品
            function add_goods(ids_str) {
              _uri = HOMESITEURL+"/Sellerinquiry/add_goods?id=" + ids_str;
                dsLayerOpen(_uri,'导入商品','900px','600px');
            }

        /**
         * Layer 通用ifram弹出窗口
         */
        function dsLayerOpen(url, title,width,height) {
            if (!width) width = '900px';
            if (!height) height = '500px';
            layer.open({
                type: 2,
                title: title,
                area: [width,height],
                fixed: false, //不固定
                maxmin: true,
                content: url
            });
        }

        $('.change_goods_storage').change(function () {
            var num = $(this).val()
            var id = $(this).attr('data-id');
            $.ajax({
                url: "{:url('sellerinquiry/ajax_up_num')}",
                type: 'get',
                data: {num: num,id:id},
                success: function (e) {
                    layer.msg(e.message);
                    setTimeout(setTimeout(function () {
                        window.location.reload();
                    }, 2000));
                }

            });
        })
        </script>


{/block}

